'use strict';

var _interopRequireWildcard = require('@babel/runtime/helpers/interopRequireWildcard');
var _interopRequireDefault = require('@babel/runtime/helpers/interopRequireDefault');
Object.defineProperty(exports, '__esModule', {
  value: true,
});
exports.default = void 0;
var _objectSpread2 = _interopRequireDefault(require('@babel/runtime/helpers/objectSpread2'));
var _react = _interopRequireWildcard(require('react'));
var _Form = _interopRequireDefault(require('../../Form'));
var _EditableTable = _interopRequireDefault(require('./EditableTable'));
require('./index.css');
var EditableTableField = function EditableTableField(props, ref) {
  return /*#__PURE__*/ _react.default.createElement(
    _Form.default.Item,
    {
      noStyle: true,
      shouldUpdate: function shouldUpdate(prevVals, currVals) {
        return prevVals[props.name] !== currVals[props.name];
      },
    },
    function (form) {
      var value = form.getFieldValue(props.name);
      return /*#__PURE__*/ _react.default.createElement(
        _EditableTable.default,
        (0, _objectSpread2.default)(
          (0, _objectSpread2.default)({}, props),
          {},
          {
            value: value,
            ref: ref,
            // @ts-ignore
            form: form,
          },
        ),
      );
    },
  );
};
var _default = /*#__PURE__*/ (0, _react.forwardRef)(EditableTableField);
exports.default = _default;
